x86/pv: Fix the handling of `int $x` for vectors which alias exceptions
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 15 May 2017 12:05:45 +0000 (13:05 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 17 May 2017 11:05:22 +0000 (12:05 +0100)
commit5c4f579e0ee4f38cad5636bbf8ce700a394338d0
treef73ad0031ac74d9f97c4fc8394a4d433ecbe54ac
parentb231884da805d21156163d3ea2ef4de2e9f65fb0
x86/pv: Fix the handling of `int $x` for vectors which alias exceptions

The claim at the top of c/s 2e426d6eecf "x86/traps: Drop use_error_code
parameter from do_{,guest_}trap()" is only actually true for hardware
exceptions.  It is not true for `int $x` instructions (which never push error
code), irrespective of whether the vector aliases an exception or not.

Furthermore, c/s 6480cc6280e "x86/traps: Fix failed ASSERT() in
do_guest_trap()" really should have helped highlight that a regression had
been introduced.

Modify pv_inject_event() to understand event types other than
X86_EVENTTYPE_HW_EXCEPTION, and introduce pv_inject_sw_interrupt() for the
`int $x` handling code.

Add further assertions to pv_inject_event() concerning the type of events
passed in, which in turn requires that do_guest_trap() set its type
appropriately (which is now used exclusively for hardware exceptions).

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Julien Grall <julien.grall@arm.com>
xen/arch/x86/traps.c
xen/include/asm-x86/domain.h